﻿<!DOCTYPE HTML>
<html>
  <head>
    <meta charset = "utf-8" /> 
    <title> TEST! </title>
      <style>
        body {width:120mm; margin-left:auto;margin-right:auto;font-size:15pt;}
      </style>
  </head>
<body> 
<?php
if(isset($_POST['number'],$_POST['dataa'],$_POST['name'],$_POST['s']))
{
session_start();
$_SESSION['number']=$_POST['number'];
$_SESSION['dataa']=$_POST['dataa'];
$_SESSION['name']=$_POST['name'];
$_SESSION['s'] = $_POST['s'];
$number = isset ( $_POST['number']) ? htmlspecialchars ( $_POST['number']) : '';
$dataa = isset ( $_POST['dataa']) ? htmlspecialchars ( $_POST['dataa']) : '';
$name = isset ( $_POST['name']) ? htmlspecialchars ( $_POST['name']) : ''; 
  if (isset ( $_POST['number'], $_POST['dataa'],$_POST['name'],$_POST['s']))
{
    if ( $_POST['number'] == true)
    if ( $_POST['dataa'] == true)
    if ( $_POST['name'] == true)
      echo '<form action="testphpforma2?page=test2" method="post">';
}
}
?>
<form action="<?php if ( isset ( $_SERVER['testphpforma2?page=test1.php'])){echo $_SERVER['testphpforma2?page=test1.php'];}?>" name="page1" method="post">
  <table border="2" cellspacing="0" cellpadding="1">
    <th width="60">
      <p>Номер счёта :</p>
    </th>
    <td align="center" valign="middle"> 
<input required type="text" maxlength="10" value="<?php if(isset($number)){echo $number;}?>"
  onkeypress="if((event.keyCode < 48)||(event.keyCode > 57)) event.returnValue=false" 
    name="number">
    </td>    
<?php
if (isset($_POST['number']))
{
  if ($_POST['number'] == '')
  {
    echo '<h5 style="color:red">Укажите номер счёта</h5>';
  }
    else
    {
        $_POST['number'] == true;
    }  
}
?>
  <tr>
    <th>Дата счёта(ДДММГГГГ):</th>
      <td align="center" valign="middle">
<input required type="date" name="dataa" maxlength="6" value="<?php if(isset($dataa)){echo $dataa;}?>"
  onkeypress="if((event.keyCode < 48)||(event.keyCode > 57)) event.returnValue=false"
    required min="2014-01-01" max="2016-01-01">
      </td> 
  </tr>
<br>
<?php
if (isset($_POST['dataa']))
{
  if ($_POST['dataa'] == '')
  {
    echo '<h5 style="color:red"> Укажите дату </h5> ';
  }
    else
    {
      $_POST['dataa'] == true;
    }
}
?>
<tr>
  <th>Наименование плательщика:</th>
    <td align="center" valign="middle">
<input required type="text"  name="name" value="<?php if(isset($name)){echo $name;}?>"  >
    </td>
</tr>
<?php
if ( isset($_POST['name']))
{
  if ( $_POST['name'] == '')
  {
    echo '<h5 style="color:red">Укажите Имя</h5>';
  }
    else
    {
      $_POST['name'] == true;
    } 
}
?>
  </table>
<p>Кол-во позиций :</p>
  <select name="s" size="1"> 
<?php
for ($i=1;$i<=10;$i++)
{
  echo '<option value='.$i.'>Позиций '.$i.'</option>';
}
?>
  </select>                                                
<input type="submit" name="send">
</form>   
</body>
</html>

    